{extend name="adminblue/base" /}
{block name="resources"/}
<style  type="text/css">
.count-top-title{}
.count-top{border:1px solid #e7e7e7; }
.count-top-title{padding:20px;overflow:hidden;}
.count-top-img{float:left;width:100px; }
.count-shop-logo{margin-top:20px;}
.count-button{cursor:pointer;background-color:rgb(77, 184, 232);border-radius:2px;border:1px solid rgb(77, 184, 232);color:#FFF;font-size:13px;padding:3px 15px;}
.count-top-text{float:left;font-size:13px;}
.count-top-text p{height:20px;line-height:20px;}
.count-bottom-title{border-top:1px solid #e7e7e7;}
.count-bottom-title-top{font-size:15px;}
.count-float-left{display:block;float:left;font-size:24px;color:#f89406;height:30px;line-hegiht:30px;}
.count-float-right{display:block;float:right;color:#00e5f2;font-size:12px;line-height:25px;cursor:pointer;}
.count-bottom-title{padding:20px;}
.table-box{width:95%;margin:0 auto;}
.count-bottom-title table tr td{width:33%;padding-left:10px;padding-right:10px;}
.count-bottom-title table{width:100%;}
.count-bottom-title table tr td:nth-child(1){border-right:1px solid #e7e7e7;}
.count-bottom-title table tr td:nth-child(2){border-right:1px solid #e7e7e7;}
.float-box{overflow:hidden;}
.tab-nav{margin-top:20px;}
.tab-nav-ul{overflow:hidden;margin-left:0px; border-bottom: 1px solid #e7e7e7;width:100%;}
.tab-nav-ul li{float:left; padding:10px  20px;border:1px  solid #e7e7e7;}
.tab-nav-ul li:hover{background-color:#00C0FF;color:#FFF; border:1px solid #e7e7e7;}
.nav-active{background-color:#00C0FF;color:#FFF; border:1px solid #e7e7e7;}
.goods-name{
	max-width:30px;
	white-space: nowrap; 
 	overflow:hidden;  
	text-overflow:ellipsis;
}
.count-count-ul{overflow:hidden; padding:10px;width:100%;border:1px  solid #e7e7e7;}
.count-count-ul ul li{float:left;border-right:1px solid #e7e7e7; padding-left:10px;padding-right:10px;}

table {
    width: 100%;
    margin: 0 auto;
    border-top: 1px solid #E3E3E3;
}
th,td{
    background: #fff;
    color: #999;
    padding: 11px;
    height: 19px;
    line-height: 19px;
    font-weight: 400;
    border-bottom: 1px solid #E3E3E3;
    /* text-align: left; */
    font-size: 12px;
}
</style>
 {/block}
{block name="main"}
<div class = "count-box">
	<div class  =  'count-top'>
		<div class="count-top-title">
			<div class='count-top-img'>				
				<img src="__UPLOAD__/{$shop_logo}" class="count-shop-logo"/>	
			</div>
			<div class="count-top-text">
				<p>店铺名称：{$shop_name}</p>
				<p>可用余额：<span style="color:#f89406;">{$shop_account_info["shop_balance"]}</span>元</p>
				<button class="count-button" onclick="window.location.href='{:__URL('ADMIN_MAIN/Account/applyShopAccountWithdraw')}'" >提现</button>			
			</div>
		</div>
		<div class="count-bottom-title">
			<div class="table-box">
			<table>
				<tr>
					<td>
						<p class="count-bottom-title-top">营业额</p>
						<div class="float-box">
							<div class="count-float-left" ><?php echo sprintf("%.2f",$shop_account_info["shop_profit"],2); ?></div>
							<div class="count-float-right"><!-- 抽成明细 --></div>
						</div>
					</td>
					<td >
						<p class="count-bottom-title-top">待结算</p>
						<div class="float-box">
							<div class="count-float-left" ><?php echo sprintf("%.2f", ($shop_account_info["shop_total_money"] - $shop_account_info["shop_proceeds"]));  ?></div>
							<div class="count-float-right"><!-- 结算明细 --></div>
						</div>
					</td>
					<td>
						<p class="count-bottom-title-top">已提现</p>
						<div class="float-box">
							<div class="count-float-left" >{$shop_account_info.shop_withdraw}</div>
							<div class="count-float-right"><!-- 提现明细 --></div>
						</div>
					</td>
				</tr>
			</table>
		</div>
		</div>
	 <table>
	 	<tr>
	 		<td>
	 		
	 		</td>
	 	</tr>
	 </table>
	</div>
</div>
<div >
	<div class="tab-nav">
		<ul class='tab-nav-ul'>
			<li onclick="LoadingInfo(1);">订单记录</li>
			<li onclick="getShopAccountWithdrawPage(1);">提现记录</li>
			<li onclick="getShopAccountRecordCount(1);">账户记录</li>
		</ul>
	</div>
	<div id="count_page">
		<!-- 订单类表 -->
		<div id="page_goods_order" >
			<table class="mytable" style="margin-top:20px;">
				<tr>
					<th>
						<!-- 方式：
						<select id="account_type">
				                    	<option value="0">请选择发生方式</option>
				                    	<option value="1">订单</option>
				                    	<option value="2">提现</option>
				        </select> -->
						<input type="text" id="startDate" class="input-sm form-control"placeholder="请选择开始日期" onclick="WdatePicker()" />
						<input type="text" id="endDate" placeholder="请选择结束日期" class="input-sm form-control"onclick="WdatePicker()" />
						<input type="button" onclick="LoadingInfo(1)" value="搜索" />
					</th>		
				</tr>
			</table>
			<div class="count-count-ul">
				<ul>
					<li>店铺营业额：<span id="shop_sale"></span></li>
					<li>店铺余额：<span id="shop_money"></span></li>
					<li>平台余额：<span id="platform_money"></span></li>
				</ul>
			</div>
			
			<div class="mod-table">
				<div class="mod-table-head">		
					<div class="style0list">
						<table>
							<colgroup>
						 		<col style="width: 10%;"> 
								<col style="width: 8%;">
								<col style="width: 10%;">
								<col style="width: 8%;">
								<col style="width: 8%;">
								<col style="width: 10%;">
								<col style="width: 8%;">
								<col style="width: 10%;">
								<col style="width: 10%;">
								<col style="width: 10%;">
								<col style="width: 8%;">
							</colgroup>
							<thead>
								<tr align="center">
				                      <th>订单编号 </th> 
				                      <th >实付金额</th>
				                      <th >平台获取金额</th>
				                      <th >产生时间</th>
				                      <th >是否结算</th>                     
				                 
								</tr>
							</thead>
							<!-- <colgroup>
						 		<col style="width: 20%;"> 
								<col style="width: 10%;">
								<col style="width: 15%;">
								<col style="width: 20%;">
								<col style="width: 8%;">
								
							</colgroup> -->
							<tbody>
								
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<!-- 提现列表 -->
		<div id="page_withdraw" class="hide">
			<table class="mytable" style="margin-top:20px;">
				<tr>
					<th>
						<!-- 方式：
						<select id="account_type">
				                    	<option value="0">请选择发生方式</option>
				                    	<option value="1">订单</option>
				                    	<option value="2">提现</option>
				        </select> -->
						<input type="text" id="startDate" class="input-sm form-control"placeholder="请选择开始日期" onclick="WdatePicker()" />
						<input type="text" id="endDate" placeholder="请选择结束日期" class="input-sm form-control"onclick="WdatePicker()" />
						<input type="button" onclick="getShopAccountWithdrawPage(1)" value="搜索" />
					</th>		
				</tr>
			</table>
			<div class="count-count-ul">
				<ul>
					<li>已提现(元)：<span id="shop_cash_withdraw"></span></li>
					<li>提现待审核(元)：<span id="shop_cash_isautit_withdraw"></span></li>					
				</ul>
			</div>
			<div class="mod-table">
				<div class="mod-table-head">
					<div class="con style0list">
						<table>
							<colgroup>

								<col style="width: 10%;">
								<col style="width: 10%;">
								<col style="width: 15%;">
								<col style="width: 9%;">
								<col style="width: 8%;">
								<col style="width: 6%;">
								<col style="width: 18%;">
								<col style="width: 18%;">
								<col style="width: 12%;">
							</colgroup>
							<thead>
								<tr>

									<th>提现流水号</th>
									<th>提现银行</th>
									<th>提现账户</th>
									<th>账户姓名</th>
									<th>手机</th>
									<th>金额</th>
									<th>提现日期</th>
									<th>到账日期</th>
									<th>状态</th>
								</tr>
							</thead>
							<colgroup>

								<col style="width: 10%;">
								<col style="width: 10%;">
								<col style="width: 15%;">
								<col style="width: 9%;">
								<col style="width: 8%;">
								<col style="width: 6%;">
								<col style="width: 18%;">
								<col style="width: 18%;">
								<col style="width: 12%;">
							</colgroup>
							<tbody></tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<div id="page_shop_account" class="hide">
			<table class="mytable" style="margin-top:20px;">
				<tr>
					<th>
						<!-- 方式：
						<select id="account_type">
				                    	<option value="0">请选择发生方式</option>
				                    	<option value="1">订单</option>
				                    	<option value="2">提现</option>
				        </select> -->
						<input type="text" id="startDate" class="input-sm form-control"placeholder="请选择开始日期" onclick="WdatePicker()" />
						<input type="text" id="endDate" placeholder="请选择结束日期" class="input-sm form-control"onclick="WdatePicker()" />
						<input type="button" onclick="getShopAccountRecordCount(1)" value="搜索" />
					</th>		
				</tr>
			</table>
			<div class="count-count-ul">
				<ul>
					<li>已提现(元)：<span id="shop_cash"></span></li>
					<li>提现待审核(元)：<span id="shop_cash_isautit"></span></li>
					<li>营业额(元)：<span id="money"></span></li>
					<li>待结算营业额(元)：<span id="money_isuse"></span></li>
				</ul>
			</div>
			<div class="mod-table" >
				<div class="mod-table-head">
					<div class="con style0list">
						<table>
							<colgroup>
			
								<!-- <col style="width: 15%;"> -->
								<col style="width: 15%;">
								<col style="width: 15%;">
								<col style="width: 15%;">
								<col style="width: 20%;">
								<col style="width: 30%;">
							</colgroup>
							<thead>
								<tr>
									
									<!-- <th>店铺</th> -->
									<th>金额</th>
									<th>发生方式</th>
								
									<th>创建时间</th>
									<th>备注</th>						
								</tr>
							</thead>
							<colgroup>
								
								<!-- <col style="width: 15%;"> -->
								<col style="width: 20%;">
								<col style="width: 20%;">
								
								<col style="width: 20%;">
								<col style="width: 30%;">
							</colgroup>
							<tbody></tbody>
						</table>
					</div>
				</div>
			</div>
			
		</div>
		<div>
		
		</div>
	</div>
	
</div>
{/block}
{block name="script"}
{include file="adminblue/pageCommon" /}
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript">
function LoadingInfo(pageIndex) {
	$("#count_page>div").hide()
	$("#page_goods_order").show();
	$(".tab-nav-ul li").removeClass("nav-active");
	$(".tab-nav-ul li:eq(0)").addClass("nav-active");
	var start_date = $("#page_goods_order #startDate").val();
	var end_date = $("#page_goods_order #endDate").val();
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/account/shopOrderAccountList')}",
		async : true,
		data : {
			"pageIndex" : pageIndex,
			"start_date":start_date,
			"end_date":end_date
		},
		success : function(data) {
			$("#shop_sale").text(data.count.shop_sale);
			$("#shop_money").text(data.count.shop_money);
			$("#platform_money").text(data.count.platform_money);
			$("#page_count").val(data.list.page_count);
			$("#pageNumber a").remove();
			var html = '';
			if (data.list["data"].length > 0) {
				for (var i = 0; i < data.list["data"].length; i++) {
					html += '<tr align="center">';
					html += '<td>' + data.list["data"][i]["order_no"] + '</td>';
					html += '<td>' + data.list["data"][i]["order_pay_money"] + '</td>';
					html += '<td>' + data.list["data"][i]["platform_money"] + '</td>';
					html += '<td>' + timeStampTurnTime(data.list["data"][i]["create_time"]) + '</td>';
					if(data.list["data"][i]["is_issue"]){
						html += '<td><i class="fa fa-check text-success"></i></td>';
					}else{
						html += '<td><i class="fa  fa-times"></i></td>';
					}																												
					
					html += '</tr>';
				}
			} else {
				html += '<tr align="center"><th colspan="12">暂无符合条件的数据记录</th></tr>';
			}
			$("#page_goods_order .style0list tbody").html(html);
			var totalpage = $("#page_count").val();
			if (totalpage == 1) {
				changeClass("all");
			}
			var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
			$("#pageNumber").append($html);
			
		}
	});
}


function getShopAccountWithdrawPage(pageIndex){
	$("#count_page>div").hide()
	$("#page_withdraw").show();
	$(".tab-nav-ul li").removeClass("nav-active");
	$(".tab-nav-ul li:eq(1)").addClass("nav-active");
	var start_date = $("#page_withdraw #startDate").val();
	var end_date = $("#page_withdraw #endDate").val();
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/account/shopAccountWithdrawList')}",
		async : true,
		data : {
			"pageIndex" : pageIndex,
			"start_date":start_date,
			"end_date":end_date
		},
		success : function(data) {	
			$("#shop_cash_withdraw").text(data.count.withdraw_cash);
			$("#shop_cash_isautit_withdraw").text(data.count.withdraw_isaudit);
			//alert(JSON.stringify(data));
			$("#page_count").val(data["list"]["page_count"]);
			$("#pageNumber a").remove();
			var html = '';
			if (data["list"]["data"].length > 0) {
				for (var i = 0; i < data["list"]["data"].length; i++) {
					var status = "";
					if(data["list"]["data"][i]["status"] == 1){
						status = "已通过";
						
					}else if(data["list"]["data"][i]["status"] == 1){
						status = "已拒绝";
					}else{
						status = "审核中";
						
					}
					var parent_realname ="";
					if(data["list"]["data"][i]["parent_realname"] != null){
						parent_realname = data["data"][i]["parent_realname"];
					}
					html += '<tr align="center">';
					html += '<td>' + data["list"]["data"][i]["withdraw_no"] + '</td>';
					html += '<td>' + data["list"]["data"][i]["bank_name"] + '</td>';
					html += '<td>' + data["list"]["data"][i]["account_number"] + '</td>';
					html += '<td>' + data["list"]["data"][i]["realname"] + '</td>';
					html += '<td>' + data["list"]["data"][i]["mobile"] + '</td>';
					html += '<td>' + data["list"]["data"][i]["cash"] + '</td>';
					html += '<td>' + timeStampTurnTime(data["list"]["data"][i]["ask_for_date"]) + '</td>';
					if(data["list"]["data"][i]["payment_date"] == null){
						html += '<td> </td>';
					}else{
						html += '<td>' + timeStampTurnTime(data["list"]["data"][i]["payment_date"]) + '</td>';
					}					
					html += '<td>' + status + '</td>';						
					html += '</tr>';
				}
			} else {
				html += '<tr align="center"><th colspan="11">暂无符合条件的数据记录</th></tr>';
			}
			
			$("#page_withdraw .style0list tbody").html(html);
			var totalpage = $("#page_count").val();
			if (totalpage == 1) {
				changeClass("all");
			}
			var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
			$("#pageNumber").append($html);
		}
	});
}
function getShopAccountRecordCount(pageIndex){
	$("#count_page>div").hide()
	$("#page_shop_account").show();
	$(".tab-nav-ul li").removeClass("nav-active");
	$(".tab-nav-ul li:eq(2)").addClass("nav-active");
	var start_date = $("#page_shop_account  #startDate").val();
	var end_date = $("#page_shop_account  #endDate").val();
	//var account_type = $("#account_type").val();
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/Account/ShopAccountRecordCount')}",
		async : true,
		data : {
			"page_index" : pageIndex,
			"start_date":start_date,
			"end_date":end_date,
			//"account_type":account_type
		},
		success : function(data) {
			$("#shop_cash").text(data.count.withdraw_cash);
			$("#shop_cash_isautit").text(data.count.withdraw_isaudit);
			$("#money").text(data.count.shop_order_money);
			$("#money_isuse").text(data.count.shop_order_money_isuse); 
			$("#page_count").val(data["list"]["page_count"]);
			$("#pageNumber a").remove();
			var html = '';
			if (data["list"]["data"].length > 0) {
				for (var i = 0; i < data["list"]["data"].length; i++) {
					html += '<tr  align="center">';
		
					/* html += '<td>' + data["list"]["data"][i]["shop_name"] + '</td>'; */
					html += '<td>' + data["list"]["data"][i]["money"] + '</td>';
					if(data["list"]["data"][i]["account_type"] == 1){
						html += '<td>订单</td>';
					}else{
						html += '<td>提现</td>';
					}
			
					html += '<td>' + timeStampTurnTime(data["list"]["data"][i]["create_time"]) + '</td>';															
					html += '<td>' + data["list"]["data"][i]["remark"] + '</td>';
					
					html += '</tr>';
				}
			} else {
				html += '<tr align="center"><th colspan="11">暂无符合条件的数据记录</th></tr>';
			}
			$("#page_shop_account .style0list tbody").html(html);
			var totalpage = $("#page_count").val();
			if (totalpage == 1) {
				changeClass("all");
			}
			var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
			$("#pageNumber").append($html);
		}
	});
}
</script>
{/block}